<% implementation_names = Implementation.names(@address) %>
<% implementation_name =
      if Enum.empty?(implementation_names) do
        nil
      else
        implementation_names |> Enum.at(0)
      end
%>
<span class="<%= if @contract do %>contract-address<% end %>" data-address-hash="<%= @address %>">
  <%= if name = if assigns[:ignore_implementation_name], do: primary_name(@address), else: implementation_name || primary_name(@address) do %>
    <%= if assigns[:no_tooltip] do %>
      <%= if @use_custom_tooltip == true do %>
        <span><%= name %> (<%= short_hash(@address) %>...)</span>
      <% else %>
        <span class="d-none d-md-none d-lg-inline d-xl-inline"><%= short_contract_name(name, 30) %></span>
        <span class="d-inline d-md-inline d-lg-none d-xl-none"><%= short_contract_name(name, 10) %></span>
        <span> (<%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %>)</span>
      <% end %>
    <% else %>
      <%= if @use_custom_tooltip == true do %>
        <span><%= name %> (<%= short_hash(@address) %>...)</span>
      <% else %>
        <span data-toggle="tooltip" data-placement="top" title="<%= @address && @address.hash %>" data-custom-class="<%= if assigns[:custom_classes_tooltip], do: @custom_classes_tooltip |> Enum.join(" ") %>">
          <span class="d-none d-md-none d-lg-inline d-xl-inline"><%= short_contract_name(name, 30) %></span>
          <span class="d-inline d-md-inline d-lg-none d-xl-none"><%= short_contract_name(name, 10) %></span>
          <span> (<%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %>)</span>
        </span>
      <% end %>
    <% end %>
  <% else %>
    <%= if assigns[:truncate] do %>
      <%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %>
    <% else %>
      <span class="d-none d-md-none d-xl-inline"><%= @address %></span>
      <span class="d-md-inline-block d-xl-none"><%= BlockScoutWeb.AddressView.trimmed_hash(@address && @address.hash) %></span>
    <% end %>
  <% end %>
</span>
